#pragma once
#ifndef MODELS_N2MODELREADER_H
#define MODELS_N2MODELREADER_H
//------------------------------------------------------------------------------
/**
    @class Models::N2ModelReader
    
    Legacy N2 binary reader, reads a subset of .n2 files into a Model.
    NOTE: This class is very inefficient and shouldn't be used
    for production code.
    
    (C) 2007 Radon Labs GmbH
*/
#include "models/load/modelreader.h"
#include "io/binaryreader.h"
#include "util/stack.h"

//------------------------------------------------------------------------------
namespace Models
{
class N2ModelReader : public ModelReader
{
    DeclareClass(N2ModelReader);
public:
    /// constructor
    N2ModelReader();
    /// destructor
    virtual ~N2ModelReader();

    /// begin reading from the stream
    virtual bool Open();
    /// end reading from the stream
    virtual void Close();

    /// set the read cursor to the first Model in the stream
    virtual bool SetToFirstModel();
    /// set the read cursor to the next Model in the stream
    virtual bool SetToNextModel();
    /// set the read cursor to the first ModelNode in the current Model
    virtual bool SetToFirstModelNode();
    /// set the read cursor to the next ModelNode in the current Model
    virtual bool SetToNextModelNode();

private:
    /// read Model data from stream
    void ReadModelData();
    /// read ModelNode data from stream
    void ReadModelNodeData();

    Ptr<IO::BinaryReader> binaryReader;
    bool isSetToModel;
    bool isSetToModelNode;
    Util::Stack<Util::StringAtom> modelNodeStack;
};

} // namespace Models
//------------------------------------------------------------------------------
#endif
    